<template>
  <div class="container">
    <p @click="bindViewTap" class="counter">打开腾讯地图插件</p>
    <p @click="openMap" class="counter">微信内置地图查看位置</p>
  </div>
</template>

<script>
export default {
    data() {
        return {
            motto: "Hello World",
            userInfo: {}
        };
    },

    methods: {
        bindViewTap() {
            const url = "../map/main";
            wx.navigateTo({ url });
        },
        openMap() {
            let mapInfo = {
                startLat: 121.6695,
                startLng: 31.268726,
                endLat: 31.264907491401107,
                endLng: 121.51072952012122,
                endName: "上海市上海市杨浦区兰州路周家嘴路1333弄"
            };
            wx.openLocation({
                //使用微信内置地图查看位置。
                latitude: Number(mapInfo.endLat), //要去的纬度-地址
                longitude: Number(mapInfo.endLng), //要去的经度-地址
                name: "",
                address: mapInfo.endName
            });
        }
    }
};
</script>

<style scoped>
.counter {
    display: inline-block;
    margin: 10px auto;
    padding: 5px 10px;
    color: blue;
    border: 1px solid blue;
}
</style>
